//
//  GoodsDetailViewController.swift
//  Retail
//
//  Created by zhangjikuan on 2020/6/30.
//  Copyright © 2020 aqdeal. All rights reserved.
//

import UIKit
import SnapKit
import Kingfisher
class GoodsDetailViewController: BaseViewController {
    
    var person:Person?
    
    var imageV:UIImageView?
    
    

    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        navigationItem.title = "商品详情"

        let btn = UIButton.init(type: .custom)
        btn.setTitleColor(.red, for: .normal)
        btn.setTitle("动画", for: .normal)
        btn.addTarget(self, action: #selector(btnClick), for: .touchUpInside)
        view.addSubview(btn)
        
        btn.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(80)
            make.size.equalTo(40)
        }
        
        
        let imageView = UIImageView()
        view.addSubview(imageView)
        
        imageView.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
            
            make.size.equalTo(100)
        }
        imageView.kf.setImage(with: URL(string: (person?.headimg!)!))

        imageV = imageView
        
        
    }
    
    @objc
    func btnClick() {
        UIView.animate(withDuration: 2) {
            self.imageV?.snp.remakeConstraints({ (make) in
                make.center.equalToSuperview()
                make.size.equalTo(self.view.frame.size.width)
            })
        }
        self.view.layoutIfNeeded()
    }
    
    
}
